package com.project.bean;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.List;

/**
 * 项目实体
 */
public class ProjectBean {
    /**项目id*/
    private int projectId;
    /**项目名*/
    private String name;
    /**客户名字*/
    private String clientName;
    /**启动资金*/
    private int money;
    /**起始日期*/
    private LocalDate startDate = LocalDate.now();
    /**结束日期*/
    private LocalDate endDate;
    /**参与项目日期*/
    private LocalDate joinDate;
    /**项目状态*/
    private String state = "开发中";
    /**参加人员集合*/
    private List<ProcessBean> employeeList;
    /**项目人数*/
    private int people;
    /**剩余天数*/
    private String remainDay;

    public ProjectBean() {
    }

    public ProjectBean(String name, String clientName, int money, LocalDate endDate) {
        this.name = name;
        this.clientName = clientName;
        this.money = money;
        this.endDate = endDate;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public List<ProcessBean> getEmployeeList() {
        return employeeList;
    }

    public void setEmployeeList(List<ProcessBean> employeeList) {
        this.employeeList = employeeList;
    }

    public LocalDate getEndDate() {
        return endDate;
    }

    public void setEndDate(LocalDate endDate) {
        this.endDate = endDate;
    }

    public LocalDate getJoinDate() {
        return joinDate;
    }

    public void setJoinDate(LocalDate joinDate) {
        this.joinDate = joinDate;
    }

    public int getPeople() {
        return people;
    }

    public void setPeople(int people) {
        this.people = people;
    }

    public String getRemainDay() {
        if ("已交付".equals(this.state)){
            return "已交付";
        }
        return ChronoUnit.DAYS.between(LocalDate.now(),endDate)+"";
    }

    public void setRemainDay(String remainDay) {
        this.remainDay = remainDay;
    }

    @Override
    public String toString() {
        return "ProjectBean{" +
                "projectId=" + projectId +
                ", name='" + name + '\'' +
                ", clientName='" + clientName + '\'' +
                ", money=" + money +
                ", startDate=" + startDate +
                ", endDate=" + endDate +
                ", joinDate=" + joinDate +
                ", state='" + state + '\'' +
                ", employeeList=" + employeeList +
                ", people=" + people +
                ", remainDay='" + remainDay + '\'' +
                "}\n";
    }
}
